import requests
import json

# res = requests.get("http://api.map.baidu.com/location/ip", params={
#     "ak":"gn8DBuXwo5IkEPosI11yYLoPELj1iA6E",
#     "ip":"116.162.93.109",
#     "coor":"bd09ll"
# })
# # print(res.text, type(res.text))
# ret = json.loads(res.text)
# print(ret, type(ret))
bdak = "gn8DBuXwo5IkEPosI11yYLoPELj1iA6E"
gdkey = "43f4d1a08835d3028cab5004363f9e9b"

res = requests.get("https://restapi.amap.com/v3/geocode/geo", params={
            "address":"湖南省长沙市",
            "key":gdkey,
        })
adcode = json.loads(res.text)['geocodes'][0]['adcode']

res = requests.get("https://restapi.amap.com/v3/weather/weatherInfo", params={
    "key":gdkey,
    "city":adcode,
    "extensions":"all",
})
print(json.loads(res.text)["lives"])
